#include "../../include/graphics/Text.hpp"
using namespace klas;
using namespace graphics;

Text::Text(Font* font)
  : Renderable(this)
{
  setFont(font);
  setText("");
  setColor(colors::AliceBlue);
}

Text::Text(string text, Font* font)
  : Renderable(this)
{
  setFont(font);
  setText(text);
  setColor(colors::Red);
}

void Text::setFont(Font* font)
{
  m_font = font;
}

Font* Text::getFont() const
{
  return m_font;
}

void Text::setText(string txt)
{
  m_text = txt;
}

string Text::getText() const
{
  return m_text;
}

void Text::setColor(const Color& col)
{
  m_color = col;
}

Color Text::getColor() const
{
  return m_color;
}

void Text::renderElement(RenderingCore* core, const math::Vector2d& origin)
{
  m_transform.pos += origin;
  core->add(m_text, m_font, m_color, m_transform, m_transparency, m_renderingLayer);
  m_transform.pos -= origin;
}